home *** CD-ROM | disk | FTP | other *** search
- ;
- ; $VER: RequestChoice.a v36.1 written by Mauro Panigada
- ;
- ; Started: 1998.07.16
- ; Finished: 1998.07.16
- ;
- ; Requirements: OS2.0 (#36), 020+ (this is 020 version, only for odd addrs, I believe!)
- ; Purpose: replace RequestChoice command, so long to me.
- ; Note: it is PURE.
- ;
- ; Usage: TITLE/A,BODY/A,GADGETS,PUBSCREEN/K
- ;
- ; TITLE: the title of the window
- ; BODY: the body text you will read
- ; GADGETS: the gadgets: retry|resume or "go on|go down|go up"
- ; PUBSCREEN: the name of a pubscreen, if you want
- ;
- ; Note: * if the given PUBSCREEN does not exist, it open the requester on the default
- ; public screen (ie often Workbench), this behavior is different from the original
- ; RequestChoice (which says "not enough memory available"!)
- ; * this RequestChoice, leaves the pressed button also in d0, so you could check it
- ; in startup-sequence as if it is an error (or a condition code returned by a prg)
- ; * the way you pass the gadgets in this RequestChoice is different: not as multiple
- ; string but as a sequence of string separated by | (so EasyRequest requires!), and
- ; you can forget it: the default gadgets are "Yes|No" for two ways answer (are you
- ; an Amiga's friend? Yes I am; no I am not.)
- ; * return code for a real error (not for gadget) is 30 (put failat 25, for example...
- ; I think it is rare you have more than 24 gadgets!)
- ;
-
-
- incdir "dh0:progr/assem/include/"
- include "exec/types.i"
- include "exec/memory.i"
- include "exec/libraries.i"
- include "exec/exec_lib.i"
- include "dos/dos.i"
- include "dos/dosextens.i"
- include "dos/dos_lib.i"
- include "intuition/intuition.i"
- include "intuition/intuition_lib.i"
-
- LIBVERSION EQU 36
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- STRUCTURE internal,0
- LONG execbase
- LONG oldstack
-
- LABEL array
- LONG title
- LONG body
- LONG gadgets
- LONG pubscreen
-
- STRUCT ERS,EasyStruct_SIZEOF
-
- LONG returncode
-
- LABEL s_size ; word aligned, please
-
-
- SECTION codice,CODE
-
- opt p=68020 ; but in old style!
-
- bra.s start
-
- dc.b "$VER: RequestChoice 36.1 [020+] (1998.07.16) "
- dc.b "by Mauro Panigada",13,10
- dc.b 0
- even
-
- start move.l sp,a0
- move.w #(s_size/2)-1,d0
- lap clr.w -(sp)
- dbf d0,lap
- move.l sp,a5
- move.l a0,oldstack(a5)
-
- move.b #30,returncode+3(a5)
- movea.l 4.w,a6
- move.l a6,(a5)
- lea dosname(pc),a1
- moveq #LIBVERSION,d0
- CALL OpenLibrary
- move.l d0,d7 ; d7=dos
- beq exit
- lea intname(pc),a1
- moveq #LIBVERSION,d0
- CALL OpenLibrary
- move.l d0,d6 ; d6=intuition
- beq exit
- move.l d7,a6
-
- lea template(pc),a0
- move.l a0,d1
- move.l a5,d2
- addq.l #array,d2
- moveq #0,d3
- CALL ReadArgs
- move.l d0,d5 ; d5=readargs
- beq argerror
-
- main lea ERS(a5),a1
- move.l #EasyStruct_SIZEOF,(a1)
- move.l body(a5),es_TextFormat(a1)
- lea stdgad(pc),a0
- move.l a0,es_GadgetFormat(a1)
- tst.l gadgets(a5)
- beq.s okarg0
- move.l gadgets(a5),es_GadgetFormat(a1)
- okarg0 move.l title(a5),es_Title(a1)
- move.l a1,-(sp)
-
- moveq #0,d4
- move.l d6,a6
- suba.l a0,a0
- tst.l pubscreen(a5)
- beq.s nops
-
- move.l pubscreen(a5),a0
- CALL LockPubScreen
- move.l d0,a0
- move.l d0,d4 ;d4=screenlock
- beq.s nops
- move.l sc_FirstWindow(a0),a0
-
- nops move.l (sp)+,a1
- suba.l a2,a2
- suba.l a3,a2
- CALL EasyRequestArgs
- move.l d0,-(sp)
- tst.l d4
- beq.s nunl
- move.l d4,a0
- CALL UnlockPubScreen
- nunl move.l d7,a6
- lea formatstr(pc),a0
- move.l a0,d1
- move.l sp,d2
- move.l (sp),returncode(a5)
- CALL VPrintf
- addq.l #4,sp
-
- exit0 move.l d5,d1
- beq.s exit
- CALL FreeArgs
-
- exit move.l d6,a1
- movea.l 4.w,a6
- CALL CloseLibrary
- move.l d7,a1
- CALL CloseLibrary
-
- move.l returncode(a5),d0
- move.l oldstack(a5),sp
- rts
-
- doserror
- argerror CALL IoErr
- move.l d0,d1
- moveq #0,d2
- CALL PrintFault
- move.b #30,returncode+3(a5)
- bra.s exit0
-
- *convert movem.l a0/a6,-(sp)
- * movea.l 4.w,a6
- * lea formatstr(pc),a0
- * lea stream(pc),a1
- * lea proc(pc),a2
- * lea cbuf(pc),a3
- * CALL RawDoFmt
- * movem.l (sp)+,a0/a6
- * rts
- *proc move.b d0,(a3)+
- * rts
-
- ;=========================================================================
- dosname dc.b "dos.library",0
- intname dc.b "intuition.library",0
- *ers dc.l EasyStruct_SIZEOF
- * dc.l 0
- * dc.l 0,0,0
- template dc.b "TITLE/A,BODY/A,GADGETS,PUBSCREEN/K",0
- formatstr dc.b "%ld"
- accapo dc.b 10,0
- stdgad dc.b "Yes|No",0
-
-
- END